package com.tanhua.server;

import com.tanhua.commons.template.AliyunOssTemplate;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

@SpringBootTest
@RunWith(SpringRunner.class)
public class Demo01 {
    @Autowired
    private AliyunOssTemplate aliyunOssTemplate;

    @Test
    public void test() throws IOException {
        InputStream is = new FileInputStream("" +
                "C:\\Users\\13011\\Desktop\\aa.jpg");
        String url = aliyunOssTemplate.upload("aa.jpg", is);
        System.out.println(url);
        is.close();

    }
}
